import React, { Component } from 'react'

export default class App extends Component {


  constructor(props){
    super(props)
    // 绑定 this
    // 可以在构造函数中修改 this 指向
    this.add = this.add.bind(this)
  }


  state = {
    count: 100
  }


  add = function(){
    console.log('你好世界', this);
  }

  render() {
    return (
      <div>
        <h1> {this.state.count} </h1>

        <button onClick={this.add}>增加</button>

      </div>
    )
  }
}
